Skip to content

Conversation

halbi2
Copy link
Contributor

@halbi2 halbi2 commented Sep 15, 2025

There is a tradition to use U.S. English spellings for APIs. For example, it's uninitialized_fill and not uninitialised_fill, specialization not specialisation, etcetera.

@halbi2 halbi2 requested a review from a team as a code owner September 15, 2025 01:47
@llvmbot llvmbot added clang Clang issues not falling into any other category libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Sep 15, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 15, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-libcxx

Author: None (halbi2)

Changes

Patch is 23.78 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/158523.diff

8 Files Affected:

  • (modified) clang/docs/LanguageExtensions.rst (+3-3)
  • (modified) clang/docs/ReleaseNotes.rst (+2-2)
  • (modified) clang/include/clang/Basic/TokenKinds.def (+4-4)
  • (modified) clang/lib/Sema/SemaTypeTraits.cpp (+8-8)
  • (renamed) clang/test/SemaCXX/type-trait-synthesizes-from-spaceship.cpp (+71-71)
  • (modified) libcxx/include/__utility/default_three_way_comparator.h (+2-2)
  • (modified) libcxx/include/string (+1-1)
  • (modified) libcxx/test/libcxx/utilities/utility/has_default_three_way.compile.pass.cpp (+1-1)
diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst
index ad190eace5b05..9d720f2eb6a92 100644
--- a/clang/docs/LanguageExtensions.rst
+++ b/clang/docs/LanguageExtensions.rst
@@ -2051,9 +2051,9 @@ The following type trait primitives are supported by Clang. Those traits marked
     Returns true if a reference ``T`` can be copy-initialized from a temporary of type
     a non-cv-qualified ``U``.
 * ``__underlying_type`` (C++, GNU, Microsoft)
-* ``__builtin_lt_synthesises_from_spaceship``, ``__builtin_gt_synthesises_from_spaceship``,
-  ``__builtin_le_synthesises_from_spaceship``, ``__builtin_ge_synthesises_from_spaceship`` (Clang):
-  These builtins can be used to determine whether the corresponding operator is synthesised from a spaceship operator.
+* ``__builtin_lt_synthesizes_from_spaceship``, ``__builtin_gt_synthesizes_from_spaceship``,
+  ``__builtin_le_synthesizes_from_spaceship``, ``__builtin_ge_synthesizes_from_spaceship`` (Clang):
+  These builtins can be used to determine whether the corresponding operator is synthesized from a spaceship operator.
 
 In addition, the following expression traits are supported:
 
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 873d63f56480c..7689b62285b84 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -112,8 +112,8 @@ What's New in Clang |release|?
 C++ Language Changes
 --------------------
 
-- A new family of builtins ``__builtin_*_synthesises_from_spaceship`` has been added. These can be queried to know
-  whether the ``<`` (``lt``), ``>`` (``gt``), ``<=`` (``le``), or ``>=`` (``ge``) operators are synthesised from a
+- A new family of builtins ``__builtin_*_synthesizes_from_spaceship`` has been added. These can be queried to know
+  whether the ``<`` (``lt``), ``>`` (``gt``), ``<=`` (``le``), or ``>=`` (``ge``) operators are synthesized from a
   ``<=>``. This makes it possible to optimize certain facilities by using the ``<=>`` operation directly instead of
   doing multiple comparisons.
 
diff --git a/clang/include/clang/Basic/TokenKinds.def b/clang/include/clang/Basic/TokenKinds.def
index 9d1a23d1af218..564d6010181cc 100644
--- a/clang/include/clang/Basic/TokenKinds.def
+++ b/clang/include/clang/Basic/TokenKinds.def
@@ -552,10 +552,10 @@ TYPE_TRAIT_1(__can_pass_in_regs, CanPassInRegs, KEYCXX)
 TYPE_TRAIT_2(__reference_binds_to_temporary, ReferenceBindsToTemporary, KEYCXX)
 TYPE_TRAIT_2(__reference_constructs_from_temporary, ReferenceConstructsFromTemporary, KEYCXX)
 TYPE_TRAIT_2(__reference_converts_from_temporary, ReferenceConvertsFromTemporary, KEYCXX)
-TYPE_TRAIT_2(__builtin_lt_synthesises_from_spaceship, LtSynthesisesFromSpaceship, KEYCXX)
-TYPE_TRAIT_2(__builtin_le_synthesises_from_spaceship, LeSynthesisesFromSpaceship, KEYCXX)
-TYPE_TRAIT_2(__builtin_gt_synthesises_from_spaceship, GtSynthesisesFromSpaceship, KEYCXX)
-TYPE_TRAIT_2(__builtin_ge_synthesises_from_spaceship, GeSynthesisesFromSpaceship, KEYCXX)
+TYPE_TRAIT_2(__builtin_lt_synthesizes_from_spaceship, LtSynthesizesFromSpaceship, KEYCXX)
+TYPE_TRAIT_2(__builtin_le_synthesizes_from_spaceship, LeSynthesizesFromSpaceship, KEYCXX)
+TYPE_TRAIT_2(__builtin_gt_synthesizes_from_spaceship, GtSynthesizesFromSpaceship, KEYCXX)
+TYPE_TRAIT_2(__builtin_ge_synthesizes_from_spaceship, GeSynthesizesFromSpaceship, KEYCXX)
 // IsDeducible is only used internally by clang for CTAD implementation and
 // is not exposed to users.
 TYPE_TRAIT_2(/*EmptySpellingName*/, IsDeducible, KEYCXX)
diff --git a/clang/lib/Sema/SemaTypeTraits.cpp b/clang/lib/Sema/SemaTypeTraits.cpp
index 1ca769ebb50f0..fb159419cf31c 100644
--- a/clang/lib/Sema/SemaTypeTraits.cpp
+++ b/clang/lib/Sema/SemaTypeTraits.cpp
@@ -1827,10 +1827,10 @@ static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT,
 
     return Self.HLSL().IsScalarizedLayoutCompatible(LhsT, RhsT);
   }
-  case BTT_LtSynthesisesFromSpaceship:
-  case BTT_LeSynthesisesFromSpaceship:
-  case BTT_GtSynthesisesFromSpaceship:
-  case BTT_GeSynthesisesFromSpaceship: {
+  case BTT_LtSynthesizesFromSpaceship:
+  case BTT_LeSynthesizesFromSpaceship:
+  case BTT_GtSynthesizesFromSpaceship:
+  case BTT_GeSynthesizesFromSpaceship: {
     EnterExpressionEvaluationContext UnevaluatedContext(
         Self, Sema::ExpressionEvaluationContext::Unevaluated);
     Sema::SFINAETrap SFINAE(Self, /*ForValidityCheck=*/true);
@@ -1849,13 +1849,13 @@ static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT,
 
     auto OpKind = [&] {
       switch (BTT) {
-      case BTT_LtSynthesisesFromSpaceship:
+      case BTT_LtSynthesizesFromSpaceship:
         return BinaryOperatorKind::BO_LT;
-      case BTT_LeSynthesisesFromSpaceship:
+      case BTT_LeSynthesizesFromSpaceship:
         return BinaryOperatorKind::BO_LE;
-      case BTT_GtSynthesisesFromSpaceship:
+      case BTT_GtSynthesizesFromSpaceship:
         return BinaryOperatorKind::BO_GT;
-      case BTT_GeSynthesisesFromSpaceship:
+      case BTT_GeSynthesizesFromSpaceship:
         return BinaryOperatorKind::BO_GE;
       default:
         llvm_unreachable("Trying to Synthesize non-comparison operator?");
diff --git a/clang/test/SemaCXX/type-trait-synthesises-from-spaceship.cpp b/clang/test/SemaCXX/type-trait-synthesizes-from-spaceship.cpp
similarity index 57%
rename from clang/test/SemaCXX/type-trait-synthesises-from-spaceship.cpp
rename to clang/test/SemaCXX/type-trait-synthesizes-from-spaceship.cpp
index ba581475bb4c7..be312f453f4be 100644
--- a/clang/test/SemaCXX/type-trait-synthesises-from-spaceship.cpp
+++ b/clang/test/SemaCXX/type-trait-synthesizes-from-spaceship.cpp
@@ -1,24 +1,24 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
 
-static_assert(!__builtin_lt_synthesises_from_spaceship()); // expected-error {{expected a type}}
-static_assert(!__builtin_lt_synthesises_from_spaceship(int)); // expected-error {{type trait requires 2 arguments; have 1 argument}}
-static_assert(!__builtin_lt_synthesises_from_spaceship(int, int, int)); // expected-error {{type trait requires 2 arguments; have 3 argument}}
-static_assert(!__builtin_lt_synthesises_from_spaceship(int, 0)); // expected-error {{expected a type}}
-
-static_assert(!__builtin_le_synthesises_from_spaceship()); // expected-error {{expected a type}}
-static_assert(!__builtin_le_synthesises_from_spaceship(int)); // expected-error {{type trait requires 2 arguments; have 1 argument}}
-static_assert(!__builtin_le_synthesises_from_spaceship(int, int, int)); // expected-error {{type trait requires 2 arguments; have 3 argument}}
-static_assert(!__builtin_le_synthesises_from_spaceship(int, 0)); // expected-error {{expected a type}}
-
-static_assert(!__builtin_gt_synthesises_from_spaceship()); // expected-error {{expected a type}}
-static_assert(!__builtin_gt_synthesises_from_spaceship(int)); // expected-error {{type trait requires 2 arguments; have 1 argument}}
-static_assert(!__builtin_gt_synthesises_from_spaceship(int, int, int)); // expected-error {{type trait requires 2 arguments; have 3 argument}}
-static_assert(!__builtin_gt_synthesises_from_spaceship(int, 0)); // expected-error {{expected a type}}
-
-static_assert(!__builtin_ge_synthesises_from_spaceship()); // expected-error {{expected a type}}
-static_assert(!__builtin_ge_synthesises_from_spaceship(int)); // expected-error {{type trait requires 2 arguments; have 1 argument}}
-static_assert(!__builtin_ge_synthesises_from_spaceship(int, int, int)); // expected-error {{type trait requires 2 arguments; have 3 argument}}
-static_assert(!__builtin_ge_synthesises_from_spaceship(int, 0)); // expected-error {{expected a type}}
+static_assert(!__builtin_lt_synthesizes_from_spaceship()); // expected-error {{expected a type}}
+static_assert(!__builtin_lt_synthesizes_from_spaceship(int)); // expected-error {{type trait requires 2 arguments; have 1 argument}}
+static_assert(!__builtin_lt_synthesizes_from_spaceship(int, int, int)); // expected-error {{type trait requires 2 arguments; have 3 argument}}
+static_assert(!__builtin_lt_synthesizes_from_spaceship(int, 0)); // expected-error {{expected a type}}
+
+static_assert(!__builtin_le_synthesizes_from_spaceship()); // expected-error {{expected a type}}
+static_assert(!__builtin_le_synthesizes_from_spaceship(int)); // expected-error {{type trait requires 2 arguments; have 1 argument}}
+static_assert(!__builtin_le_synthesizes_from_spaceship(int, int, int)); // expected-error {{type trait requires 2 arguments; have 3 argument}}
+static_assert(!__builtin_le_synthesizes_from_spaceship(int, 0)); // expected-error {{expected a type}}
+
+static_assert(!__builtin_gt_synthesizes_from_spaceship()); // expected-error {{expected a type}}
+static_assert(!__builtin_gt_synthesizes_from_spaceship(int)); // expected-error {{type trait requires 2 arguments; have 1 argument}}
+static_assert(!__builtin_gt_synthesizes_from_spaceship(int, int, int)); // expected-error {{type trait requires 2 arguments; have 3 argument}}
+static_assert(!__builtin_gt_synthesizes_from_spaceship(int, 0)); // expected-error {{expected a type}}
+
+static_assert(!__builtin_ge_synthesizes_from_spaceship()); // expected-error {{expected a type}}
+static_assert(!__builtin_ge_synthesizes_from_spaceship(int)); // expected-error {{type trait requires 2 arguments; have 1 argument}}
+static_assert(!__builtin_ge_synthesizes_from_spaceship(int, int, int)); // expected-error {{type trait requires 2 arguments; have 3 argument}}
+static_assert(!__builtin_ge_synthesizes_from_spaceship(int, 0)); // expected-error {{expected a type}}
 
 namespace std {
   struct strong_ordering {
@@ -35,10 +35,10 @@ struct DefaultSpaceship {
   friend auto operator<=>(DefaultSpaceship, DefaultSpaceship) = default;
 };
 
-static_assert(__builtin_lt_synthesises_from_spaceship(const DefaultSpaceship&, const DefaultSpaceship&));
-static_assert(__builtin_le_synthesises_from_spaceship(const DefaultSpaceship&, const DefaultSpaceship&));
-static_assert(__builtin_gt_synthesises_from_spaceship(const DefaultSpaceship&, const DefaultSpaceship&));
-static_assert(__builtin_ge_synthesises_from_spaceship(const DefaultSpaceship&, const DefaultSpaceship&));
+static_assert(__builtin_lt_synthesizes_from_spaceship(const DefaultSpaceship&, const DefaultSpaceship&));
+static_assert(__builtin_le_synthesizes_from_spaceship(const DefaultSpaceship&, const DefaultSpaceship&));
+static_assert(__builtin_gt_synthesizes_from_spaceship(const DefaultSpaceship&, const DefaultSpaceship&));
+static_assert(__builtin_ge_synthesizes_from_spaceship(const DefaultSpaceship&, const DefaultSpaceship&));
 
 struct CustomSpaceship {
   int i;
@@ -48,10 +48,10 @@ struct CustomSpaceship {
   }
 };
 
-static_assert(__builtin_lt_synthesises_from_spaceship(const CustomSpaceship&, const CustomSpaceship&));
-static_assert(__builtin_le_synthesises_from_spaceship(const CustomSpaceship&, const CustomSpaceship&));
-static_assert(__builtin_gt_synthesises_from_spaceship(const CustomSpaceship&, const CustomSpaceship&));
-static_assert(__builtin_ge_synthesises_from_spaceship(const CustomSpaceship&, const CustomSpaceship&));
+static_assert(__builtin_lt_synthesizes_from_spaceship(const CustomSpaceship&, const CustomSpaceship&));
+static_assert(__builtin_le_synthesizes_from_spaceship(const CustomSpaceship&, const CustomSpaceship&));
+static_assert(__builtin_gt_synthesizes_from_spaceship(const CustomSpaceship&, const CustomSpaceship&));
+static_assert(__builtin_ge_synthesizes_from_spaceship(const CustomSpaceship&, const CustomSpaceship&));
 
 struct CustomLT {
   int i;
@@ -61,10 +61,10 @@ struct CustomLT {
   }
 };
 
-static_assert(!__builtin_lt_synthesises_from_spaceship(const CustomLT&, const CustomLT&));
-static_assert(!__builtin_le_synthesises_from_spaceship(const CustomLT&, const CustomLT&));
-static_assert(!__builtin_gt_synthesises_from_spaceship(const CustomLT&, const CustomLT&));
-static_assert(!__builtin_ge_synthesises_from_spaceship(const CustomLT&, const CustomLT&));
+static_assert(!__builtin_lt_synthesizes_from_spaceship(const CustomLT&, const CustomLT&));
+static_assert(!__builtin_le_synthesizes_from_spaceship(const CustomLT&, const CustomLT&));
+static_assert(!__builtin_gt_synthesizes_from_spaceship(const CustomLT&, const CustomLT&));
+static_assert(!__builtin_ge_synthesizes_from_spaceship(const CustomLT&, const CustomLT&));
 
 struct CustomLE {
   int i;
@@ -74,10 +74,10 @@ struct CustomLE {
   }
 };
 
-static_assert(!__builtin_lt_synthesises_from_spaceship(const CustomLE&, const CustomLE&));
-static_assert(!__builtin_le_synthesises_from_spaceship(const CustomLE&, const CustomLE&));
-static_assert(!__builtin_gt_synthesises_from_spaceship(const CustomLE&, const CustomLE&));
-static_assert(!__builtin_ge_synthesises_from_spaceship(const CustomLE&, const CustomLE&));
+static_assert(!__builtin_lt_synthesizes_from_spaceship(const CustomLE&, const CustomLE&));
+static_assert(!__builtin_le_synthesizes_from_spaceship(const CustomLE&, const CustomLE&));
+static_assert(!__builtin_gt_synthesizes_from_spaceship(const CustomLE&, const CustomLE&));
+static_assert(!__builtin_ge_synthesizes_from_spaceship(const CustomLE&, const CustomLE&));
 
 struct CustomGT {
   int i;
@@ -87,10 +87,10 @@ struct CustomGT {
   }
 };
 
-static_assert(!__builtin_lt_synthesises_from_spaceship(const CustomGT&, const CustomGT&));
-static_assert(!__builtin_le_synthesises_from_spaceship(const CustomGT&, const CustomGT&));
-static_assert(!__builtin_gt_synthesises_from_spaceship(const CustomGT&, const CustomGT&));
-static_assert(!__builtin_ge_synthesises_from_spaceship(const CustomGT&, const CustomGT&));
+static_assert(!__builtin_lt_synthesizes_from_spaceship(const CustomGT&, const CustomGT&));
+static_assert(!__builtin_le_synthesizes_from_spaceship(const CustomGT&, const CustomGT&));
+static_assert(!__builtin_gt_synthesizes_from_spaceship(const CustomGT&, const CustomGT&));
+static_assert(!__builtin_ge_synthesizes_from_spaceship(const CustomGT&, const CustomGT&));
 
 struct CustomGE {
   int i;
@@ -100,10 +100,10 @@ struct CustomGE {
   }
 };
 
-static_assert(!__builtin_lt_synthesises_from_spaceship(const CustomGE&, const CustomGE&));
-static_assert(!__builtin_le_synthesises_from_spaceship(const CustomGE&, const CustomGE&));
-static_assert(!__builtin_gt_synthesises_from_spaceship(const CustomGE&, const CustomGE&));
-static_assert(!__builtin_ge_synthesises_from_spaceship(const CustomGE&, const CustomGE&));
+static_assert(!__builtin_lt_synthesizes_from_spaceship(const CustomGE&, const CustomGE&));
+static_assert(!__builtin_le_synthesizes_from_spaceship(const CustomGE&, const CustomGE&));
+static_assert(!__builtin_gt_synthesizes_from_spaceship(const CustomGE&, const CustomGE&));
+static_assert(!__builtin_ge_synthesizes_from_spaceship(const CustomGE&, const CustomGE&));
 
 struct CustomLTAndSpaceship {
   int i;
@@ -117,10 +117,10 @@ struct CustomLTAndSpaceship {
   }
 };
 
-static_assert(!__builtin_lt_synthesises_from_spaceship(const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
-static_assert(__builtin_le_synthesises_from_spaceship(const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
-static_assert(__builtin_gt_synthesises_from_spaceship(const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
-static_assert(__builtin_ge_synthesises_from_spaceship(const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
+static_assert(!__builtin_lt_synthesizes_from_spaceship(const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
+static_assert(__builtin_le_synthesizes_from_spaceship(const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
+static_assert(__builtin_gt_synthesizes_from_spaceship(const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
+static_assert(__builtin_ge_synthesizes_from_spaceship(const CustomLTAndSpaceship&, const CustomLTAndSpaceship&));
 
 struct CustomLEAndSpaceship {
   int i;
@@ -134,10 +134,10 @@ struct CustomLEAndSpaceship {
   }
 };
 
-static_assert(__builtin_lt_synthesises_from_spaceship(const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
-static_assert(!__builtin_le_synthesises_from_spaceship(const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
-static_assert(__builtin_gt_synthesises_from_spaceship(const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
-static_assert(__builtin_ge_synthesises_from_spaceship(const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
+static_assert(__builtin_lt_synthesizes_from_spaceship(const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
+static_assert(!__builtin_le_synthesizes_from_spaceship(const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
+static_assert(__builtin_gt_synthesizes_from_spaceship(const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
+static_assert(__builtin_ge_synthesizes_from_spaceship(const CustomLEAndSpaceship&, const CustomLEAndSpaceship&));
 
 struct CustomGTAndSpaceship {
   int i;
@@ -151,10 +151,10 @@ struct CustomGTAndSpaceship {
   }
 };
 
-static_assert(__builtin_lt_synthesises_from_spaceship(const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
-static_assert(__builtin_le_synthesises_from_spaceship(const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
-static_assert(!__builtin_gt_synthesises_from_spaceship(const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
-static_assert(__builtin_ge_synthesises_from_spaceship(const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
+static_assert(__builtin_lt_synthesizes_from_spaceship(const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
+static_assert(__builtin_le_synthesizes_from_spaceship(const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
+static_assert(!__builtin_gt_synthesizes_from_spaceship(const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
+static_assert(__builtin_ge_synthesizes_from_spaceship(const CustomGTAndSpaceship&, const CustomGTAndSpaceship&));
 
 struct CustomGEAndSpaceship {
   int i;
@@ -168,10 +168,10 @@ struct CustomGEAndSpaceship {
   }
 };
 
-static_assert(__builtin_lt_synthesises_from_spaceship(const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
-static_assert(__builtin_le_synthesises_from_spaceship(const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
-static_assert(__builtin_gt_synthesises_from_spaceship(const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
-static_assert(!__builtin_ge_synthesises_from_spaceship(const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
+static_assert(__builtin_lt_synthesizes_from_spaceship(const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
+static_assert(__builtin_le_synthesizes_from_spaceship(const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
+static_assert(__builtin_gt_synthesizes_from_spaceship(const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
+static_assert(!__builtin_ge_synthesizes_from_spaceship(const CustomGEAndSpaceship&, const CustomGEAndSpaceship&));
 
 struct DefaultedCmpAndSpaceship {
   int i;
@@ -187,10 +187,10 @@ struct DefaultedCmpAndSpaceship {
 };
 
 // TODO: This should probably return true
-static_assert(!__builtin_lt_synthesises_from_spaceship(const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
-static_assert(!__builtin_le_synthesises_from_spaceship(const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
-static_assert(!__builtin_gt_synthesises_from_spaceship(const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
-static_assert(!__builtin_ge_synthesises_from_spaceship(const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
+static_assert(!__builtin_lt_synthesizes_from_spaceship(const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
+static_assert(!__builtin_le_synthesizes_from_spaceship(const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
+static_assert(!__builtin_gt_synthesizes_from_spaceship(const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
+static_assert(!__builtin_ge_synthesizes_from_spaceship(const DefaultedCmpAndSpaceship&, const DefaultedCmpAndSpaceship&));
 
 struct DifferentTypes {
   int i;
@@ -200,13 +200,13 @@ struct DifferentTypes {
   }
 };
 
-static_assert(__builtin_lt_synthesises_from_spaceship(const DifferentTypes&, const int&));
-static_assert(__builtin_le_synthesises_from_spaceship(const DifferentTypes&, const int&));
-static_assert(__builtin_gt_synthesises_from_spaceship(const DifferentTypes&, const int&));
-static_assert(__builtin_ge_synthesises_from_spaceship(const Diff...
[truncated]

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICT both spellings are correct. What's the reasoning for switching it?

@Zingam
Copy link
Contributor

Zingam commented Sep 16, 2025

AFAICT both spellings are correct. What's the reasoning for switching it?

A quick search shows "synthesise" - 19 hits vs "synthesize" - 618 hits.

@halbi2
Copy link
Contributor Author

halbi2 commented Sep 18, 2025

Yes, "synthesize" is also the only spelling used in the C++ Standard. https://eel.is/c++draft/over.match#oper-3.4.2 "For the relational ([expr.rel]) and three-way comparison ([expr.spaceship]) operators, the rewritten candidates also include a synthesized candidate"

The word is "synthesis" but as a verb "synthesize".

@halbi2
Copy link
Contributor Author

halbi2 commented Sep 23, 2025

@ChuanqiXu9 You added the spelling "synthesised" in a comment in clang/lib/AST/DeclBase.cpp. What is your opinion?

@hyp You added the spelling "synthesised" in a comment in clang/lib/Sema/SemaObjCProperty.cpp. What is your opinion?

@jmorse You added the spelling "synthesising" in a comment in llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp. What is your opinion?

These are the only three instances of "synthesis[ei]" I found in the codebase (outside of tests).

@jmorse
Copy link
Member

jmorse commented Sep 23, 2025

No strong opinion, I typically use British-English spellings where 's' is favoured over 'z', but I'm quite possibly wrong on spelling, and don't mind it being normalised whichever way.

@hubert-reinterpretcast
Copy link
Collaborator

There is somewhat of a tradition to use U.S. English spellings for APIs. For example, it's uninitialized_fill and not uninitialised_fill.

@philnik777
Copy link
Contributor

But please add the reasoning in the description.

There is a tradition to use U.S. English spellings for APIs. For example, it's uninitialized_fill and not uninitialised_fill, specialization not specialisation, etcetera.
@halbi2
Copy link
Contributor Author

halbi2 commented Sep 30, 2025

But please add the reasoning in the description.

@philnik777 thank you! I have done so. Would you help me by landing this please?

@cor3ntin cor3ntin merged commit b9e41ae into llvm:main Sep 30, 2025
76 of 79 checks passed
@nico
Copy link
Contributor

nico commented Sep 30, 2025

As-is, this requires updating clang and libc++ at the same time, as -D__builtin_lt_synthesises_from_spaceship=__builtin_lt_synthesizes_from_spaceship doesn't seem to have an effect within __has_feature.

Does anyone have a different suggestion that might enable updating both independently?

If not, is there any way we could tweak either clang or libc++ to also provide / use the old spelling for a bit, so that the two updates don't have to be coupled?

@philnik777
Copy link
Contributor

Why does it require updating them at the same time? If you use an older Clang with a newer libc++, __has_feature(__builtin_lt_synthesizes_from_spaceship) will simply return false. If you use a newer Clang with an older libc++, __has_feature(__builtin_lt_synthesises_from_spaceship) also returns false. So in both cases the special spaceship stuff in libc++ should simply be disabled.

@nico
Copy link
Contributor

nico commented Oct 1, 2025

Yes, but we have tests that are sensitive to this, and we already updated them when we rolled in the original libc++ change. Our options are now:

  • disable them until both clang and libc++ have rolled, then remember to enable them again (and lose the libc++ optimization we had picked up until then)
  • put __has_feature(...) checks in the test (…but I suppose this would also require checking that we're on new-enough libc++) and then remember to remove it again once both have rolled (and also lose the optimization until then)

mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
There is a tradition to use U.S. English spellings for APIs. For
example, it's uninitialized_fill and not uninitialised_fill,
specialization not specialisation, etcetera.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants